import java.util.Random;
import java.util.Scanner;

/**
 * Created by dllo on 18/3/31.
 */
public class Test03 {
    public static void main(String[] args) {
        Random random = new Random();
        Scanner scanner = new Scanner(System.in);
        int money = 5000;
        int b = 0;//运行多少次了
        /*
        1. 用户有5000元
        2. 用户输入大小(0-大,1-小)
        3. 生成三个1-6 的随机数作为骰子
        4. 根据点数和 判断大小
        5. 根据点数大小,和用户输入的大小进行比较,
            如果一致,用户金额+50
            如果不一致, 用户金额 -50
        6. 用户没钱了 让他退出
        7. 循环 2-6*/
        while (true) {
            //TODO  添加提示
            System.out.println("输入大小:1是大,0是小");
            int a = scanner.nextInt();
            if (a != 0 && a != 1){
                System.out.println("输入错误");
                continue;
            }
            int num = random.nextInt(6) + 1;
            System.out.println(num);
            int num1 = random.nextInt(6) + 1;
            System.out.println(num1);
            int num2 = random.nextInt(6) + 1;
            System.out.println(num2);
            int rawnum = num + num1 + num2; // 和
            if (rawnum > 11 && rawnum <= 17) {
                //大
                if (a == 1) {
                    //赢
                    System.out.println("你赢了");
                    money = money + 100;
                    System.out.println(money);
                } else {
                    //输
                    System.out.println("你输了");
                    money = money - 100;
                    System.out.println(money);
                }
            } else {
                // 小
                if (a == 1) {
                    // 输
                    System.out.println("你输了");
                    money = money - 100;
                    System.out.println(money);
                } else {
                    // 赢
                    System.out.println("你赢了");
                    money = money + 100;
                    System.out.println(money);
                }

            }

            if (money <= 0) {
                break;
            }
            b++;
            System.out.println(b);
        }
    }

}
